import pandas as pd
import numpy as np
import plotly.express as px
df = pd.read_csv('Salon_Data.csv')
df.head(10)
| date | time | haircut | price | hair_stylist | gender | type | rating | |
|---|---|---|---|---|---|---|---|---|
| 0 | 01-07-2021 | morning | hair | 150 | Asim | Male | regular | 4.0 |
| 1 | 01-07-2021 | morning | hair | 250 | Viraj | Female | new | 4.7 |
| 2 | 01-07-2021 | noon | beard | 100 | Atif | Male | regular | 4.2 |
| 3 | 01-07-2021 | noon | hair | 150 | Asim | Male | new | 3.7 |
| 4 | 01-07-2021 | noon | all | 350 | Viraj | Male | regular | 4.8 |
| 5 | 01-07-2021 | mid noon | beard | 100 | Atif | Male | regular | 4.1 |
| 6 | 01-07-2021 | mid noon | all | 300 | Asim | Male | regular | 4.3 |
| 7 | 01-07-2021 | noon | all | 300 | Asim | Male | regular | 4.3 |
| 8 | 01-07-2021 | morning | hair | 150 | Asim | Male | regular | 4.0 |
| 9 | 01-07-2021 | noon | hair | 250 | Viraj | Female | new | 4.7 |
from plotly.offline import init_notebook_mode
init_notebook_mode()
fig = px.scatter(df, x="rating", color='hair_stylist', y="date", range_x=[3.5,5], range_y=[0,13],template='plotly_dark', animation_frame = 'gender', size_max=20)
fig.show()
fig = px.scatter_3d(df, x='rating', y='date', z=df['haircut'].replace({'all':1,'beard':2, 'hair':3}),
symbol='hair_stylist')
fig.show()
fig = px.box(df, y="price",points='all')
fig.show()
date_count = df.date.value_counts().sort_index()
date_count
01-07-2021 30 02-07-2021 21 03-07-2021 21 04-07-2021 30 05-07-2021 35 06-07-2021 29 07-07-2021 30 08-07-2021 25 09-07-2021 17 10-07-2021 27 11-07-2021 33 12-07-2021 47 Name: date, dtype: int64
fig = px.line(df, x=date_count.keys(), y=date_count, title='Sales of haircut')
fig.show()
fig = px.violin(df, y=df.price, title= 'Sales with respect to price')
fig.show()
Price Vs Rating
fig = px.scatter(df, x="rating", y="price", color="rating", marginal_y="violin",
marginal_x="box", trendline="ols", template="simple_white",
title='Price vs Rating')
fig.show()
The amount earned is approximatley same of all hairstylist.
fig = px.pie(df, values='price', names='hair_stylist', color='hair_stylist', hole=.3, color_discrete_map={'Atif':'#1261A0','Asim':'#072F5F','Viraj':'#3895D3'})
fig.show()
Using rating on all hairstylist we know that Viraj is best and Atif, Asim are equaly competing each other
fig = px.pie(df, values='rating', names='hair_stylist', color='hair_stylist', hole=0.3, color_discrete_map={'Atif':'#1261A0','Asim':'#072F5F','Viraj':'#3895D3'})
fig.show()
The below graph shows that, There are more men haircuts than women, which also states that men vist frequently than women.
fig = px.pie(df, values='price', names='gender', color='gender', color_discrete_map={'Male':'#006279', 'Female':'#abc0bb'})
fig.show()
The below graph states that.
fig = px.pie(df, values='price', names='haircut', color='haircut', hole=0.3, color_discrete_map={'all':'#1261A0','hair':'#072F5F','beard':'#3895D3'})
fig.show()
73.4% customer prefer their regular hairstyle and 26.6% prefer something new.
fig = px.pie(df, values='price', names='type', color='type', color_discrete_map={'new':'#006279', 'regular':'#abc0bb'})
fig.show()
The below graph is intereactive visual representation of density heatmap between price and rating.
we can see that, 41 ratings with value '4.1' are given to price ranging between 150-190.
fig = px.density_heatmap(df, x="rating", y="price", marginal_x="histogram", marginal_y="histogram", color_continuous_scale=px.colors.sequential.Greys)
fig.show()